package controllers;
import play.*;
import play.data.validation.Valid;
import play.libs.Mail;
import play.mvc.*;


import java.util.*;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

import models.*;

public class Emails extends Controller {

	/**
	 * mailSend method creates an object of type 
	 * email then call the method from the model
	 * which send an email then render it in 
	 * HTML page
	 * @author Mohamed Abdel Kader
	 * @param email to create email and take its parameters from the HTML */
    public static void mailSend (Email email){
    	
       	try {
			email.sendEmail();
			
		} catch (EmailException exception) {
			
			exception.printStackTrace();
		}		
		
		render(email);
    	
    }
    

    /**A method to render the html file of the email form
     * @author Mohamed Abdel Kader*/
	public static void sendEmail(){
    	render();}
}
